from sklearn import preprocessing
import numpy as np

# 初始化数据，每一行表示一个样本，每一列表示一个特征
x = np.array([[0., -3., 1.],
              [3., 1., 2.],
              [0., 1., -1.]])
y = np.random.rand(3, 3)
# 将数据进行 [0,1] 规范化
# scaler = preprocessing.MinMaxScaler()
# scaler.fit(x)
# minmax_x = scaler.fit_transform(x)
# minmax_y = scaler.fit_transform(y)
# print(x, '\n', minmax_x)
# print(y, '\n', minmax_y)
#
# print(scaler.min_, scaler.data_max_)


from sklearn.preprocessing import MinMaxScaler
# data = [[-1, 2], [-0.5, 6], [0, 10], [1, 18]]
data = np.array([[0., -3., 1.],
              [3., 1., 2.],
              [0., 1., -1.]])
y = np.random.rand(3, 3)

scaler = MinMaxScaler()
print(scaler.fit(data))
#MinMaxScaler()
print(scaler.data_max_)

print(scaler.transform(data))

print(scaler.transform([[2, 2], [1, 1]]))


